<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        .box {
            width: 1346px;
            height: 728px;
            background-color: blueviolet;
            position: relative;
        }
        
        .son {
            position: absolute;
            bottom: 0;
            right: 100px;
            width: 141.5px;
            height: 249px;
            background-image: url(./1.png);
            /* animation: bear .5s steps(4) infinite, move 3s linear; */
        }
        
        .son:hover {
            /* width: 283px;
            height: 249px; */
            background-position: 20%, 50%;
        }
        
        .aniamtion_hj {
            /* position: absolute; */
            animation: bear .5s steps(4) infinite, move 3s linear;
        }
        
        @keyframes bear {
            from {
                background-position: -296px 0;
            }
            to {
                background-position: -892px 0;
            }
        }
        
        @keyframes move {
            /* 0% {
                transform: translate(0, -);
            }
            25% {
                transform: translate(0, 0)
            }
            26% {
                transform: translate(0, 0)
            }
            50% {
                transform: translate(0, -400px)
            }
            51% {
                transform: translate(0, -400px)
            }
            75% {
                transform: translate(0, -400px)
            } */
            100% {
                transform: translate(0, -500px);
            }
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="son"></div>
    </div>

    <script>
        let btn = document.querySelector('.son');
        let step = 20;

        let html = document.documentElement;
        console.log(html.scrollTop);
        btn.addEventListener('click', function() {
            btn.classList.add('aniamtion_hj')
            let timer = setInterval(function() {

                html.scrollTop -= step;
                console.log(html.scrollTop);
                if (html.scrollTop == 0) {
                    clearInterval(timer);

                }

            }, 16)
        });
    </script>
</body>

</html>